#include "sys.h"
/////////////////////////////////////////// 
float pitch,roll,yaw; 								  			 
short aacx,aacy,aacz;													 
uint32_t gyrox,gyroy,gyroz;											 
float temp; 								  			

u8 aa;
int x,y,z;
///////////////////////////////////////////
int main(void)	
{ 
  	delay_init();	    	           
	NVIC_Configuration();
	uart1_init(9600);
	TIM3_Init(99,10000);
	OLED_Init();
	MPU_Init();
	mpu_dmp_init();
    	

	OLED_ShowString(1,1,"X :");
	OLED_ShowString(2,1,"Y :");
	OLED_ShowString(3,1,"Z :");
	//OLED_ShowString(0,6,"Temp :");
	while(1)
    {

        //while(mpu_dmp_get_data(&pitch,&roll,&yaw)!=0);
		//mpu_dmp_get_data(&pitch,&roll,&yaw);		//dmp四元数解算欧拉角
		//temp=MPU_Get_Temperature();				//读取温度
		MPU_Get_Accelerometer(&aacx,&aacy,&aacz);	//读取加速度
		MPU_Get_Gyroscope(&gyrox,&gyroy,&gyroz);        //读取陀螺仪
        x = (gyrox/100)-547;
        y = (gyroy/100) + 89;
        z = (gyroz/100) + 97;
        OLED_ShowNum(1,4,x,3);
        OLED_ShowNum(2,4,y,3);
        OLED_ShowNum(3,4,z,3);
        printf("X=%d, Y=%d, Z=%d \n",gyrox/1000,gyroy/1000,gyroz/1000);
        
     } 	
}













